<template>
  <div class="shangpinxq">
    <div class="xiangqing-header">
      <!--<router-link :to="{name: 'shouye/muying'}">-->
      <img @click="Back()" class="back" src="../../assets/img/shouye/header-xinpin/back.png"/>
      <!--</router-link>-->
      <p>商品详情</p>
      <div class="share">
        <img src="../../assets/img/shouye/shouye-shangpinxiangqing/购物车前.png"/>
        <img @click="isFX = true" src="../../assets/img/shouye/header-xinpin/share.png"/>
        <router-link :to="{name: 'shouye'}">
          <img src="../../assets/img/shouye/shouye-shangpinxiangqing/首页.png"/>
        </router-link>
      </div>
    </div>
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide"><img :src="this.obj.src" alt=""></div>
        <div class="swiper-slide"><img :src="this.obj.src" alt=""></div>
        <div class="swiper-slide"><img :src="this.obj.src" alt=""></div>
        <div class="swiper-slide"><img :src="this.obj.src" alt=""></div>
        <div class="swiper-slide"><img :src="this.obj.src" alt=""></div>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>
    </div>
    <div class="price">
      <h3>
        <img src="../../assets/img/shouye/shouye-shangpinxiangqing/guoqi.png" alt="">
        <span>{{this.obj.baoyou}}</span>
        {{this.obj.name}}
      </h3>
      <h4>￥{{this.obj.price}}</h4>
      <h5>关税：￥{{this.obj.guanshui}} <span>详情 > </span></h5>
      <h5>邮费：￥{{this.obj.youfei}}</h5>
      <h6>
        <img src="../../assets/img/shouye/shouye-shangpinxiangqing/jifengou.png" alt="">
        500000积分可抵500元，限购1件
      </h6>
    </div>
    <div class="zhiyou">
      <ul>
        <li>
          <img src="../../assets/img/shouye/shouye-shangpinxiangqing/buzhichi.png" alt=""><span>不支持7天无忧退换</span>
        </li>
        <li>
          <img src="../../assets/img/shouye/shouye-shangpinxiangqing/feiji.png" alt=""><span>海外直邮</span>
        </li>
        <li>
          <img src="../../assets/img/shouye/shouye-shangpinxiangqing/zhengpin.png" alt=""><span>正品保证 > </span>
        </li>
      </ul>
      <h3>
        <img src="../../assets/img/shouye/shouye-shangpinxiangqing/guoqi.png" alt="">
        <p>
          直邮，下单时需要提供真实姓名和身份证号以及收货地址,请先去添加并填写这些信息
          <span>去添加</span>
        </p>
      </h3>
    </div>
    <ul class="chanpinjs">
      <li>
        <img src="../../assets/img/shouye/shouye/aladeng.png" alt="">
        阿拉丁精选
      </li>
      <li>
        <p>
          {{this.obj.desc}}
        </p>
      </li>
    </ul>
    <ul class="shangpinxx">
      <li>
        <h3>商品信息</h3>
      </li>
      <li>【品    牌】ANFNA</li>
      <li>【规    格】{{this.obj.guige}}</li>
      <li>【产    地】{{this.obj.chandi}}</li>
      <li>【储存方法】{{this.obj.chucun}}</li>
      <li>【保 质 期】2年</li>
      <li>【生产日期】{{this.obj.date}}
      </li>
      <li>【快递信息】{{this.obj.kuaidi}}</li>
      <li>【服务信息】{{this.obj.fuwu}}</li>
      <li>【温馨提示】{{this.obj.tishi}}</li>
    </ul>
    <div class="chengnuo">
      <h3><span></span>品牌承诺<span></span></h3>
      <ul>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-shangpinxiangqing/zhengpin2.png" alt="">
          </div>
          <p>正品保证</p>
        </li>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-shangpinxiangqing/feiji2.png" alt="">
          </div>
          <p>海外直邮</p>
        </li>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-shangpinxiangqing/butie.png" alt="">
          </div>
          <p>超时发货补贴</p>
        </li>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-shangpinxiangqing/picc.png" alt="">
          </div>
          <p>PICC承保</p>
        </li>
      </ul>
    </div>
    <div class="xiaotieshi">
      <img src="../../assets/img/shouye/shouye-shangpinxiangqing/xiaotieshi.png" alt="">
      <p>
        {{this.obj.xiaotieshi}}
      </p>
    </div>
    <div class="remai">
      <h3>热卖推荐</h3>
      <ul>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-meishi/yeshenglanmei.png" alt="">
          </div>
          <h4>野生蓝莓果汁饮料</h4>
          <h5>¥100</h5>
        </li>
        <li>
          <div>
            <img src="../../assets/img/shouye/shouye-meishi/yuanweijianguo.png" alt="">
          </div>
          <h4>原味坚果</h4>
          <h5>¥99</h5>
        </li>
      </ul>
    </div>
    <div class="more">
      <h3><span></span>继续拖动，查看图文详情<span></span></h3>
    </div>
    <ul class="kefu">
      <li>
        <img src="../../assets/img/shouye/shouye-shangpinxiangqing/kefu.png" alt="">
        在线客服
      </li>
      <li>
        <span>加入购物车</span>
      </li>
    </ul>
    <div class="up" @click="toTop()" v-if="isUP">
      <img src="../../assets/img/shouye/tuijian-xuanliyanzhuang/toTop.png"/>
    </div>
    <div class="fenxiang-mengban" v-if="isFX">
      <div class="fenxiang">
        <ul>
          <li>
            <ul class="fenxiang-list">
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/pengyouquan.png"/>
                </div>
                <p>微信朋友圈</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/weixin.png"/></div>
                <p>微信好友</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/QQ.png"/></div>
                <p>QQ好友</p>
              </li>
            </ul>
          </li>
          <li>
            <ul class="fenxiang-list">
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/QQkongjian.png"/></div>
                <p>QQ空间</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/weibo.png"/></div>
                <p>微博</p>
              </li>
              <li>
                <div>
                  <img src="../../assets/img/shouye/fenxiang/fuzhilianjie.png"/></div>
                <p>复制链接</p>
              </li>
            </ul>
          </li>
        </ul>
        <div @click="quxiao()">
          取消
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import * as $ from 'jquery'
  import * as Swiper from 'swiper'
  import "swiper/dist/css/swiper.css"
  import '../../style/mySwiper.css'

  export default {
    data() {
      return {
        isUP: false,
        isFX: false,
        obj: {},
      }
    },
    computed: {
//      getID () {
//        return this.$route.params.good;
//        console.log('111', this.$route.params.good)
//      }
    },
    mounted() {
      new Swiper['default']('.swiper-container', {
        loop: true,
        autoplay: true,
        // 如果需要分页器
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
          bulletActiveClass: 'my-bullet-active',
        },
      }),
        window.addEventListener('scroll', this.menu);
        this.obj = this.$route.params.good;
//        console.log(this.obj);
    },
    methods: {
      quxiao() {
        this.isFX = false
      },
      Back() {
        this.$router.go(-1)
      },
      toTop() {
        if (document.documentElement) {
          document.documentElement.scrollTop = 0;
        } else {
          document.body.scrollTop = 0;
        }
      },
      menu() {
        this.scroll = document.documentElement.scrollTop || document.body.scrollTop;
        if (this.scroll > 0) {
          //显示 a 标签
          this.isUP = true;
        } else {
          //隐藏 a 标签
          this.isUP = false;
        }
      },
      top() {
        window.scrollTo(0, 0)
      }
    },
    created() {
      this.top();
//      this.src = getID.src;
//      console.log(this.$route.params);
    }
  }
</script>
<style scoped>
  .shangpinxq {
    position: relative;
    width: 100%;
    padding-top: 2rem;
    background: #f2f2f2;
  }

  .xiangqing-header {
    width: 100%;
    height: 2rem;
    line-height: 2rem;
    background: #e53e42;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
  }

  .back {
    vertical-align: middle;
    width: 0.6rem;
    margin-left: 0.5rem;
  }

  .xiangqing-header > p {
    width: 8rem;
    padding-left: 2.5rem;
    height: 100%;
    text-align: center;
    display: inline-block;
    font-family: MicrosoftYaHei;
    font-size: 0.7rem;
    font-weight: normal;
    font-stretch: normal;
    color: #ffffff;

  }

  .share {
    display: inline-block;
  }

  .share img {
    vertical-align: middle;
    width: 0.8rem;
  }

  .swiper-slide {
    text-align: center;
    background: #fff;
    height: 6rem;
  }

  .swiper-slide img {
    width: 20%;
    padding: 1rem;
  }
  .price {
    border-bottom: 1px solid #ccc;
    padding: 0.5rem;
    background: #fff;
  }

  .price h3 {
    font-family: MicrosoftYaHei;
    font-size: 0.8rem;
    font-weight: normal;
    font-stretch: normal;
    color: #333333;
  }

  .price h3 span {
    color: #e53e42;
  }

  .price h4 {
    margin-top: 0.5rem;
    font-family: MicrosoftYaHei;
    font-size: 1rem;
    font-weight: normal;
    font-stretch: normal;
    color: #e53e42;
  }

  .price h5 {
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .price h5 span {
    font-size: 0.5rem;
    color: #e53e42;
    border: 1px solid #e53e42;
    padding: 0 0.1rem;
  }

  .price h6 {
    padding: 0.3rem 0;
    font-size: 0.7rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .price h6 img {
    vertical-align: middle;
    width: 2rem;
  }

  .zhiyou {
    background: #fff;
  }

  .zhiyou ul {
    display: flex;
    padding-left: 0.2rem;
  }

  .zhiyou ul li {
    text-align: center;
    flex: 1;
  }

  .zhiyou ul li img {
    width: 0.6rem;
    vertical-align: middle;
  }

  .zhiyou ul li span {
    padding-left: 0.1rem;
    display: inline-block;
    font-size: 0.5rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .zhiyou h3 {
    display: flex;
    padding: 0 0.2rem 0.2rem 0.2rem;
  }

  .zhiyou h3 img {
    width: 1.2rem;
    height: 1rem;
    vertical-align: middle;
    margin-top: 0.2rem;
  }

  .zhiyou h3 p {
    flex: 1;
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #e53e42;
    padding-left: 0.2rem;
  }

  .zhiyou h3 p span {
    border: 1px solid #e53e42;
    color: #e53e42;
    font-size: 0.5rem;
    padding: 0.1rem 0.2rem;
    margin: 1rem 0 0 2.8rem;
  }

  .chanpinjs {
    display: flex;
    padding: 0.2rem;
    margin: 0.5rem 0;
    background: #fff;
  }

  .chanpinjs img {
    width: 3rem;
    height: 3rem;
    background: #ccc;
  }

  .chanpinjs li {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .chanpinjs li p {
    margin-left: 0.2rem;
  }

  .shangpinxx {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
    padding: 0.2rem;
    background: #fff;
  }

  .shangpinxx li {
    margin: 0.2rem 0;
  }

  .shangpinxx p {
    font-size: 0.7rem;
  }

  .chengnuo {
    padding: 0.5rem 0;
    background: #fff;
    margin: 0.2rem 0;
  }

  .chengnuo h3 {
    text-align: center;
    font-family: MicrosoftYaHei;
    font-size: 0.9rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
    margin-bottom: 0.1rem;
  }

  .chengnuo h3 > span {
    display: inline-block;
    width: 4rem;
    height: 0.3rem;
    border-top: 2px solid #4d4d4d;
    margin: 0 0.3rem;
  }

  .chengnuo ul {
    display: flex;
  }

  .chengnuo ul li {
    flex: 1;
    text-align: center;
  }

  .chengnuo ul li div {
    width: 2rem;
    height: 2rem;
    margin: 0 auto;
    line-height: 2rem;
  }

  .chengnuo img {
    width: 1.5rem;
    vertical-align: middle;
  }

  .chengnuo p {
    font-family: MicrosoftYaHei;
    font-size: 0.5rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1.37rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
  }

  .xiaotieshi img {
    width: 80%;
    margin: 0.2rem 10%;
  }

  .xiaotieshi p {
    margin: 0.2rem 0.5rem;
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .remai {
    background: #fff;
    padding: 0.2rem;
  }

  .remai h3 {
    font-family: MicrosoftYaHei;
    font-size: 0.8rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
    margin-left: 0.5rem;
  }

  .remai ul {
    display: flex;
  }

  .remai ul li {
    flex: 1;
    text-align: center;
    border: 1px solid #ccc;
    margin: 0.5rem;
    padding: 0.5rem;
  }

  .remai ul li div {
    width: 5rem;
    height: 5rem;
    margin: 0 auto;
    line-height: 5rem;
  }

  .remai ul li div img {
    width: 80%;
    vertical-align: middle;
  }

  .remai ul li h4 {
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .remai ul li h5 {
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #e53e42;
  }

  .more {
    margin: 0.5rem 0;
  }

  .more h3 {
    text-align: center;
    font-family: MicrosoftYaHei;
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
    margin-bottom: 0.1rem;
  }

  .more h3 > span {
    display: inline-block;
    width: 4.1rem;
    height: 0.2rem;
    border-top: 1px solid #4d4d4d;
    margin: 0 0.3rem;
  }

  .kefu {
    display: flex;
  }

  .kefu li {
    text-align: center;
    flex: 1;
  }

  .kefu li {
    font-family: MicrosoftYaHei;
    font-size: 0.8rem;
    font-weight: normal;
    font-stretch: normal;
    line-height: 1.37rem;
    letter-spacing: 0rem;
    color: #4d4d4d;
    padding: 0.5rem;
  }

  .kefu img {
    width: 1rem;
    /*vertical-align: middle;*/
  }

  .kefu li:nth-child(1) {
    background: #fff;
  }

  .kefu li:nth-child(2) {
    background: #e53e42;
    color: white;
  }

  .up {
    width: 1.5rem;
    position: fixed;
    bottom: 0;
    right: 0.3rem;
  }

  .up img {
    width: 100%;
  }

  .fenxiang-mengban {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
  }

  .fenxiang {
    padding-top: 1rem;
    background: #fff;
    width: 100%;
    height: 10rem;
    position: absolute;
    bottom: 0;
    left: 0;
  }

  .fenxiang-list {
    display: flex;
  }

  .fenxiang-list li {
    flex: 1;
    text-align: center;
  }

  .fenxiang-list div {
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.5rem auto;
  }

  .fenxiang-list div img {
    width: 100%;
  }

  .fenxiang-list p {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    color: #4d4d4d;
  }

  .fenxiang > div {
    font-size: 0.6rem;
    font-weight: normal;
    font-stretch: normal;
    background: #e53e42;
    color: #fff;
    width: 3rem;
    text-align: center;
    padding: 0.2rem;
    border-radius: 0.2rem;
    margin: 0.5rem auto;
  }
</style>
